package cn.haoxsf.app.system.service.impl;

import cn.haoxsf.app.common.util.ToolUtil;
import cn.haoxsf.app.system.entity.MemberRole;
import cn.haoxsf.app.system.mapper.MemberRoleMapper;
import cn.haoxsf.app.system.service.IMemberRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 后台用户角色表 服务实现类
 * </p>
 *
 * @author Ele  qvbanfm@qq.com
 * @since 2020-01-06
 */
@Service
public class MemberRoleServiceImpl extends ServiceImpl<MemberRoleMapper, MemberRole> implements IMemberRoleService {

    /**
     * 查询用户下的所有权限
     *
     * @param memberId
     * @return
     */
    @Override
    public List<MemberRole> findRoleByMemberId(Long memberId) {
        return this.baseMapper.findRoleByMemberId(memberId);
    }

    /**
     * 查询用户全部角色
     *
     * @return
     */
    @Override
    public List<MemberRole> findRoleAll() {
        List<MemberRole> roleList = this.baseMapper.selectList(null);
        if(ToolUtil.isNotEmpty(roleList)){
            return roleList;
        }
        return null;
    }
}
